function saveTicket(rewardPoint,size){
    var ticketId = $.trim($("#ticketId").val());
	var ticketIdStrs = $("#ticketIdStrs").val();
	if(ticketId != "" && ticketIdStrs.indexOf(ticketId) < 0){
		$.post('../lotteryTicket/searchLotteryTicketById',{id:ticketId,rewardPoint:rewardPoint},function(result){
			if (result.code != 1 ){
	           	   $.messager.alert('提示',result.msg);
	           }else{
		        	var showStr = "<tr><td colspan="+size+">";
	                //实物券
	                if(result.obj.type==1){

			        }
		        	//现金券
		        	else if(result.obj.type==2){
		        		showStr +="奖池Id"+result.obj.id+":奖券金额"+result.obj.amount+"元,生效时间"+result.obj.startTime+"至 "+result.obj.endTime+",使用门槛"+result.obj.investMiniAmount+"元,"+result.obj.borrowTypes+"可用。 ";
		        	}
					//加息券
		        	else if(result.obj.type==3){
		        		showStr +="奖池Id"+result.obj.id+":加息率"+result.obj.addInterestRate+"%,生效时间"+result.obj.startTime+"至 "+result.obj.endTime+",最大投资金额"+result.obj.maxInvestAmount+"元,"+result.obj.borrowTypes+"可用。 ";
			        }
					//体验金
		        	else if(result.obj.type==4){
		        		showStr += "奖池Id"+result.obj.id;
		        		if(result.obj.amount!=null){
		        			showStr += ":体验券金额"+result.obj.amount+"元,";
			 		    }else if(result.obj.maxInvestAmount!=null){
			 		    	showStr += ":体验券金额"+result.obj.maxInvestAmount+"元,";	
				 		}else{
				 			showStr += ":体验券金额无上限,";
					 	}
		        		showStr += "生效时间"+result.obj.startTime+"至 "+result.obj.endTime;
			        }
					//费用抵用券
		        	else if(result.obj.type==5){

			        }
	                //三方红包
		        	else if(result.obj.type==6){

			        }
	              	//现金红包
		        	else if(result.obj.type==7){
		        		showStr += "奖池Id"+result.obj.id;
		        		if(result.obj.amount!=null){
		        			showStr += ":现金红包返现金额"+result.obj.amount+"元,";
			 		    }else{
				 			showStr += ":现金红包返现比例"+result.obj.investBackRate+"%";
					 	}
		        		showStr += "生效时间"+result.obj.startTime+"至 "+result.obj.endTime;
			        }	
	                //票券
		        	else if(result.obj.type==9){
		        		showStr += "奖池Id"+result.obj.id;
		        		showStr += ":票券金额"+result.obj.amount+"元,";
		        		showStr += "生效时间"+result.obj.startTime+"至 "+result.obj.endTime;
			        }	else if(result.obj.type==12){
		        		showStr += "奖池Id"+result.obj.id;
		        		showStr += ":奖券类型:积分券,";
		        		showStr += "生效时间"+result.obj.startTime+"至 "+result.obj.endTime;
			        }	
		        	showStr += "<lable onclick='deleteTicket(this"+","+result.obj.id+")' style='cursor:pointer'><font color='red'>删除</font></lable>";
		        	showStr += "</td></tr>";
		        	$("#tickets").append(showStr);
		        	ticketIdStrs += result.obj.id + ",";
		        	$("#ticketIdStrs").val(ticketIdStrs);
	           }
	         },'json');
	}else if(ticketId == ""){
		$.messager.alert('提示',"请填写奖券Id!");
	}else if(ticketIdStrs.indexOf(ticketId)>-1){
		$.messager.alert('提示',"该奖池已经添加!");
	}
}
/**
 * 删除已经添加奖池
 */
function deleteTicket(obj,ticketId){
	var ticketIdStrs = $.trim($("#ticketIdStrs").val());
	ticketId = ticketId+",";
	ticketIdStrs = ticketIdStrs.replace(ticketId,"");
	$(obj).parent().parent().remove();
	$("#ticketIdStrs").val(ticketIdStrs);
}
/**
 * 删除所有奖池
 */
function deleteTickets(){
	$("#tickets").children().remove();
	$("#ticketIdStrs").val("");
}